package chapter03;

import java.util.LinkedList;

public class Deque<E> {

    private LinkedList<E> data;

    public Deque() {
        this.data = new LinkedList<>();
    }

    void push(E e) {
        data.addFirst(e);
    }

    E pop() {
        E e = data.removeFirst();
        return e;
    }

    void inject(E e) {
        data.addLast(e);
    }

    E eject() {
        E e = data.removeLast();
        return e;
    }
}
